Load all required libraries.

library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.6     v dplyr   1.0.8
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   2.1.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(broom)

Read in raw data from RDS.

raw_data <- readRDS("./n1_n2_cleaned_cases.rds")

Make a few small modifications to names and data for visualizations.

final_data <- raw_data %>% mutate(log_copy_per_L = log10(mean_copy_num_L)) %>%
  rename(Facility = wrf) %>%
  mutate(Facility = recode(Facility, 
                           "NO" = "WRF A",
                           "MI" = "WRF B",
                           "CC" = "WRF C"))

Seperate the data by gene target to ease layering in the final plot

#make three data layers
only_positives <<- subset(final_data, (!is.na(final_data$Facility)))
only_n1 <- subset(only_positives, target == "N1")
only_n2 <- subset(only_positives, target == "N2")
only_background <<-final_data %>% 
  select(c(date, cases_cum_clarke, new_cases_clarke, X7_day_ave_clarke)) %>%
  group_by(date) %>% summarise_if(is.numeric, mean)

#specify fun colors
background_color <- "#7570B3"
seven_day_ave_color <- "#E6AB02"
marker_colors <- c("N1" = '#1B9E77',"N2" ='#D95F02')
#remove facilty C for now
#only_n1 <- only_n1[!(only_n1$Facility == "WRF C"),]
#only_n2 <- only_n2[!(only_n2$Facility == "WRF C"),]

only_n1 <- only_n1[!(only_n1$Facility == "WRF A" & only_n1$date == "2020-11-02"), ]
only_n2 <- only_n2[!(only_n2$Facility == "WRF A" & only_n2$date == "2020-11-02"), ]

Build the main plot

      #first layer is the background epidemic curve
        p1 <- only_background %>%
              plotly::plot_ly() %>%
              plotly::add_trace(x = ~date, y = ~new_cases_clarke, 
                                type = "bar", 
                                hoverinfo = "text",
                                text = ~paste('</br> Date: ', date,
                                                     '</br> Daily Cases: ', new_cases_clarke),
                                alpha = 0.5,
                                name = "Daily Reported Cases",
                                color = background_color,
                                colors = background_color,
                                showlegend = FALSE) %>%
            layout(yaxis = list(title = "Clarke County Daily Cases", showline=TRUE)) %>%
            layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
        
        #renders the main plot layer two as seven day moving average
        p1 <- p1 %>% plotly::add_trace(x = ~date, y = ~X7_day_ave_clarke, 
                             type = "scatter",
                             mode = "lines",
                             hoverinfo = "text",
                            text = ~paste('</br> Date: ', date,
                                                     '</br> Seven-Day Moving Average: ', X7_day_ave_clarke),
                             name = "Seven Day Moving Average Athens",
                             line = list(color = seven_day_ave_color),
                             showlegend = FALSE)
      

        
        #renders the main plot layer three as positive target hits
        
        p2 <- plotly::plot_ly() %>%
          plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
                                       type = "scatter",
                                       mode = "markers",
                                       hoverinfo = "text",
                                       text = ~paste('</br> Date: ', date,
                                                     '</br> Facility: ', Facility,
                                                     '</br> Target: ', target,
                                                     '</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
                                       data = only_n1,
                                       symbol = ~Facility,
                                       marker = list(color = '#1B9E77', size = 8, opacity = 0.65),
                                       showlegend = FALSE) %>%
          plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
                                       type = "scatter",
                                       mode = "markers",
                                       hoverinfo = "text",
                                       text = ~paste('</br> Date: ', date,
                                                     '</br> Facility: ', Facility,
                                                     '</br> Target: ', target,
                                                     '</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
                                       data = only_n2,
                                       symbol = ~Facility,
                                       marker = list(color = '#D95F02', size = 8, opacity = 0.65),
                                       showlegend = FALSE) %>%
            layout(yaxis = list(title = "SARS CoV-2 Copies/L", 
                                 showline = TRUE,
                                 type = "log",
                                 dtick = 1,
                                 automargin = TRUE)) %>%
            layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
        
        #adds the limit of detection dashed line
        p2 <- p2 %>% plotly::add_segments(x = as.Date("2020-03-14"), 
                                          xend = ~max(date + 10), 
                                          y = 3571.429, yend = 3571.429,
                                          opacity = 0.35,
                                          line = list(color = "black", dash = "dash")) %>%
          layout(annotations = list(x = as.Date("2020-03-28"), y = 3.8, xref = "x", yref = "y", 
                                    text = "Limit of Detection", showarrow = FALSE))

        

        p1
        p2

Combine the two main plot pieces as a subplot

#seperate n1 and n2 frames by site
#n1
wrf_a_only_n1 <- subset(only_n1, Facility == "WRF A")
wrf_b_only_n1 <- subset(only_n1, Facility == "WRF B")
wrf_c_only_n1 <- subset(only_n1, Facility == "WRF C")

#n2
wrf_a_only_n2 <- subset(only_n2, Facility == "WRF A")
wrf_b_only_n2 <- subset(only_n2, Facility == "WRF B")
wrf_c_only_n2 <- subset(only_n2, Facility == "WRF C")


#rejoin the old data frames then seperate in to averages for each plant. 
wrfa_both <- full_join(wrf_a_only_n1, wrf_a_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfb_both <- full_join(wrf_b_only_n1, wrf_b_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfc_both <- full_join(wrf_c_only_n1, wrf_c_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
#get max date
maxdate <- max(wrfa_both$date)
mindate <- min(wrfa_both$date)

Build loess smoothing figures figures

This makes the individual plots

#**************************************WRF A PLOT**********************************************
#add trendlines 
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_botha <- ggplot(wrfa_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_botha<<-..y..), method = "loess", color = '#1B9E77', 
              span = 0.25, n = 779)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_botha
## `geom_smooth()` using formula 'y ~ x'

fit_botha
##   [1] 13.05251 13.04776 13.04306 13.03841 13.03382 13.02929 13.02480 13.02037
##   [9] 13.01599 13.01165 13.00737 13.00313 12.99894 12.99479 12.99069 12.98664
##  [17] 12.98263 12.97866 12.97473 12.97084 12.96699 12.96318 12.95941 12.95567
##  [25] 12.95197 12.94831 12.94468 12.94108 12.93752 12.93398 12.93048 12.92701
##  [33] 12.92356 12.92014 12.91675 12.91339 12.91005 12.90674 12.90345 12.90018
##  [41] 12.89693 12.89370 12.89050 12.88731 12.88413 12.88098 12.87785 12.87473
##  [49] 12.87165 12.86859 12.86557 12.86257 12.85961 12.85669 12.85381 12.85098
##  [57] 12.84818 12.84544 12.84274 12.84010 12.83751 12.83497 12.83250 12.83009
##  [65] 12.82774 12.82546 12.82325 12.82110 12.81904 12.81704 12.81513 12.81330
##  [73] 12.81155 12.80988 12.80830 12.80682 12.80542 12.80412 12.80292 12.80182
##  [81] 12.80082 12.79993 12.79914 12.79846 12.79789 12.79733 12.79667 12.79592
##  [89] 12.79509 12.79418 12.79320 12.79217 12.79109 12.78997 12.78881 12.78763
##  [97] 12.78643 12.78522 12.78401 12.78280 12.78161 12.78045 12.77931 12.77821
## [105] 12.77716 12.77617 12.77524 12.77438 12.77360 12.77291 12.77232 12.77183
## [113] 12.77145 12.77119 12.77106 12.77107 12.77122 12.77152 12.77199 12.77262
## [121] 12.77343 12.77443 12.77562 12.77701 12.77861 12.78042 12.78247 12.78474
## [129] 12.78792 12.79255 12.79850 12.80562 12.81377 12.82280 12.83258 12.84297
## [137] 12.85380 12.86496 12.87628 12.88764 12.89888 12.90986 12.92044 12.93048
## [145] 12.93983 12.94835 12.95590 12.96234 12.96752 12.97303 12.98045 12.98963
## [153] 13.00039 13.01257 13.02600 13.04052 13.05597 13.07217 13.08898 13.10621
## [161] 13.12370 13.14129 13.15882 13.17612 13.19302 13.20936 13.22498 13.23970
## [169] 13.25337 13.26582 13.27688 13.28640 13.29419 13.30011 13.30398 13.30689
## [177] 13.31003 13.31334 13.31678 13.32030 13.32386 13.32742 13.33093 13.33434
## [185] 13.33761 13.34069 13.34354 13.34612 13.34838 13.35027 13.35175 13.35278
## [193] 13.35330 13.35328 13.35267 13.35142 13.34950 13.34684 13.34342 13.33918
## [201] 13.33408 13.32808 13.32113 13.31318 13.30419 13.29324 13.27960 13.26351
## [209] 13.24522 13.22497 13.20300 13.17956 13.15490 13.12925 13.10286 13.07597
## [217] 13.04883 13.02167 12.99476 12.96832 12.94260 12.91785 12.89430 12.87221
## [225] 12.85181 12.83336 12.81443 12.79264 12.76830 12.74170 12.71314 12.68293
## [233] 12.65136 12.61874 12.58535 12.55151 12.51751 12.48366 12.45024 12.41757
## [241] 12.38594 12.35565 12.32700 12.30029 12.27582 12.25389 12.23480 12.21766
## [249] 12.20136 12.18583 12.17105 12.15696 12.14352 12.13067 12.11839 12.10661
## [257] 12.09529 12.08439 12.07386 12.06365 12.05373 12.04403 12.03452 12.02516
## [265] 12.01588 12.00666 11.99743 11.98816 11.97881 11.96931 11.95963 11.94973
## [273] 11.93955 11.93007 11.92220 11.91577 11.91063 11.90661 11.90357 11.90133
## [281] 11.89975 11.89865 11.89790 11.89731 11.89675 11.89604 11.89503 11.89356
## [289] 11.89147 11.88860 11.88480 11.87990 11.87375 11.86618 11.85765 11.84873
## [297] 11.83947 11.82990 11.82009 11.81007 11.79988 11.78958 11.77921 11.76881
## [305] 11.75843 11.74811 11.73791 11.72785 11.71800 11.70839 11.69908 11.69009
## [313] 11.68149 11.67332 11.66562 11.65692 11.64590 11.63281 11.61793 11.60150
## [321] 11.58379 11.56505 11.54555 11.52555 11.50531 11.48507 11.46512 11.44570
## [329] 11.42707 11.40950 11.39325 11.37856 11.36572 11.35496 11.34656 11.34077
## [337] 11.33785 11.33621 11.33417 11.33183 11.32930 11.32670 11.32414 11.32172
## [345] 11.31956 11.31777 11.31646 11.31575 11.31573 11.31652 11.31824 11.32100
## [353] 11.32490 11.33005 11.33658 11.34458 11.35417 11.36626 11.38152 11.39968
## [361] 11.42049 11.44369 11.46901 11.49620 11.52499 11.55512 11.58634 11.61838
## [369] 11.65099 11.68389 11.71685 11.74958 11.78184 11.81335 11.84387 11.87313
## [377] 11.90088 11.92684 11.95076 11.97239 11.99466 12.02045 12.04937 12.08102
## [385] 12.11502 12.15097 12.18848 12.22716 12.26662 12.30646 12.34630 12.38575
## [393] 12.42441 12.46190 12.49781 12.53177 12.56337 12.59224 12.61797 12.64017
## [401] 12.65846 12.67499 12.69209 12.70965 12.72754 12.74564 12.76384 12.78201
## [409] 12.80003 12.81779 12.83516 12.85202 12.86825 12.88374 12.89837 12.91200
## [417] 12.92453 12.93583 12.94579 12.95427 12.96117 12.96637 12.96935 12.96983
## [425] 12.96796 12.96394 12.95791 12.95007 12.94058 12.92962 12.91736 12.90397
## [433] 12.88962 12.87449 12.85876 12.84259 12.82615 12.80962 12.79318 12.77700
## [441] 12.76124 12.74608 12.73170 12.71827 12.70595 12.69493 12.68538 12.67746
## [449] 12.66925 12.65884 12.64645 12.63233 12.61669 12.59977 12.58180 12.56301
## [457] 12.54362 12.52386 12.50397 12.48418 12.46470 12.44579 12.42765 12.41053
## [465] 12.39464 12.38023 12.36752 12.35674 12.34812 12.34001 12.33071 12.32039
## [473] 12.30920 12.29730 12.28484 12.27198 12.25889 12.24571 12.23261 12.21974
## [481] 12.20726 12.19533 12.18410 12.17374 12.16439 12.15623 12.14939 12.14405
## [489] 12.14036 12.13848 12.13843 12.14005 12.14318 12.14770 12.15345 12.16029
## [497] 12.16809 12.17671 12.18599 12.19580 12.20599 12.21643 12.22698 12.23748
## [505] 12.24780 12.25781 12.26734 12.27627 12.28445 12.29174 12.29800 12.30519
## [513] 12.31518 12.32770 12.34246 12.35919 12.37762 12.39746 12.41845 12.44030
## [521] 12.46273 12.48548 12.50826 12.53079 12.55281 12.57403 12.59417 12.61296
## [529] 12.63013 12.64539 12.65847 12.66909 12.67697 12.68185 12.68531 12.68909
## [537] 12.69313 12.69739 12.70179 12.70629 12.71083 12.71535 12.71979 12.72409
## [545] 12.72821 12.73207 12.73563 12.73883 12.74161 12.74391 12.74568 12.74685
## [553] 12.74738 12.74720 12.74626 12.74450 12.74186 12.73829 12.73373 12.72812
## [561] 12.72140 12.71352 12.70350 12.69058 12.67506 12.65719 12.63727 12.61558
## [569] 12.59238 12.56797 12.54263 12.51662 12.49024 12.46376 12.43746 12.41162
## [577] 12.38653 12.36245 12.33967 12.31847 12.29913 12.28192 12.26713 12.25195
## [585] 12.23361 12.21245 12.18880 12.16303 12.13545 12.10643 12.07629 12.04539
## [593] 12.01407 11.98266 11.95151 11.92096 11.89136 11.86305 11.83636 11.81164
## [601] 11.78924 11.76950 11.75275 11.73934 11.72777 11.71632 11.70503 11.69394
## [609] 11.68306 11.67245 11.66212 11.65212 11.64247 11.63321 11.62436 11.61598
## [617] 11.60807 11.60069 11.59386 11.58761 11.58199 11.57701 11.57271 11.56913
## [625] 11.56630 11.56425 11.56302 11.56263 11.56312 11.56453 11.56777 11.57362
## [633] 11.58184 11.59222 11.60453 11.61854 11.63403 11.65078 11.66856 11.68715
## [641] 11.70632 11.72585 11.74552 11.76510 11.78437 11.80311 11.82108 11.83807
## [649] 11.85385 11.86819 11.88088 11.89367 11.90834 11.92469 11.94253 11.96168
## [657] 11.98195 12.00314 12.02507 12.04754 12.07037 12.09336 12.11633 12.13908
## [665] 12.16142 12.18317 12.20413 12.22412 12.24293 12.26039 12.27631 12.29048
## [673] 12.30383 12.31735 12.33102 12.34480 12.35866 12.37256 12.38648 12.40038
## [681] 12.41423 12.42799 12.44163 12.45512 12.46842 12.48151 12.49434 12.50689
## [689] 12.51912 12.53100 12.54249 12.55357 12.56420 12.57435 12.58398 12.59339
## [697] 12.60288 12.61243 12.62198 12.63150 12.64097 12.65034 12.65958 12.66865
## [705] 12.67752 12.68615 12.69450 12.70255 12.71025 12.71757 12.72447 12.73092
## [713] 12.73688 12.74232 12.74720 12.75148 12.75537 12.75909 12.76261 12.76594
## [721] 12.76907 12.77197 12.77465 12.77709 12.77927 12.78121 12.78287 12.78425
## [729] 12.78534 12.78613 12.78661 12.78677 12.78660 12.78608 12.78522 12.78399
## [737] 12.78239 12.78047 12.77829 12.77585 12.77315 12.77018 12.76694 12.76343
## [745] 12.75965 12.75558 12.75124 12.74661 12.74170 12.73650 12.73100 12.72521
## [753] 12.71913 12.71274 12.70606 12.69906 12.69176 12.68415 12.67622 12.66796
## [761] 12.65938 12.65048 12.64126 12.63173 12.62188 12.61173 12.60127 12.59050
## [769] 12.57943 12.56807 12.55641 12.54445 12.53221 12.51967 12.50685 12.49375
## [777] 12.48037 12.46671 12.45278
#assign fits to a vector
both_trenda <- fit_botha

#extract y min and max for each
limits_botha <- ggplot_build(extract_botha)$data
## `geom_smooth()` using formula 'y ~ x'
limits_botha <- as.data.frame(limits_botha)
both_ymina <- limits_botha$ymin
both_ymaxa <- limits_botha$ymax

#reassign dataframes (just to be safe)
work_botha <- wrfa_both

#fill in missing dates to smooth fits
work_botha <- work_botha %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_botha <- work_botha$date

#create a new smooth dataframe to layer
smooth_frame_botha <- data.frame(date_vec_botha, both_trenda, both_ymina, both_ymaxa)
#WRF A
#plot smooth frames
p_wrf_a <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_botha, y = ~both_trenda,
                    data = smooth_frame_botha,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_botha,
                                  '</br> Median Log Copies: ', round(both_trenda, digits = 2)),
                    line = list(color = '#1B9E77', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_botha, ymin = ~both_ymina, ymax = ~both_ymaxa,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_botha, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxa, digits = 2),
                                  '</br> Min Log Copies: ', round(both_ymina, digits = 2)),
                    name = "",
                    fillcolor = '#1B9E77',
                    line = list(color = '#1B9E77')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF A") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfa_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#1B9E77', size = 6, opacity = 0.65))

p_wrf_a
save(p_wrf_a, file = "./plotly_objs/p_wrf_a.rda")
#**************************************WRF B PLOT**********************************************
#add trendlines 
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_bothb <- ggplot(wrfb_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_bothb<<-..y..), method = "loess", color = '#D95F02', 
              span = 0.25, n = 779)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothb
## `geom_smooth()` using formula 'y ~ x'

fit_bothb
##   [1] 12.63008 12.62522 12.62044 12.61576 12.61117 12.60667 12.60227 12.59795
##   [9] 12.59372 12.58957 12.58552 12.58155 12.57767 12.57387 12.57017 12.56654
##  [17] 12.56300 12.55955 12.55617 12.55288 12.54968 12.54655 12.54351 12.54054
##  [25] 12.53766 12.53486 12.53213 12.52948 12.52692 12.52442 12.52201 12.51967
##  [33] 12.51741 12.51522 12.51311 12.51107 12.50911 12.50722 12.50540 12.50365
##  [41] 12.50197 12.50037 12.49883 12.49737 12.49597 12.49464 12.49339 12.49221
##  [49] 12.49110 12.49007 12.48912 12.48824 12.48745 12.48674 12.48611 12.48556
##  [57] 12.48510 12.48473 12.48445 12.48426 12.48416 12.48415 12.48424 12.48442
##  [65] 12.48470 12.48508 12.48556 12.48614 12.48682 12.48761 12.48851 12.48951
##  [73] 12.49062 12.49184 12.49317 12.49461 12.49617 12.49785 12.49964 12.50155
##  [81] 12.50358 12.50573 12.50801 12.51041 12.51293 12.51563 12.51855 12.52169
##  [89] 12.52503 12.52856 12.53229 12.53620 12.54028 12.54453 12.54894 12.55350
##  [97] 12.55820 12.56304 12.56801 12.57310 12.57831 12.58362 12.58903 12.59453
## [105] 12.60011 12.60577 12.61150 12.61728 12.62312 12.62901 12.63493 12.64089
## [113] 12.64686 12.65285 12.65885 12.66485 12.67083 12.67681 12.68276 12.68868
## [121] 12.69456 12.70039 12.70617 12.71189 12.71754 12.72312 12.72904 12.73570
## [129] 12.74302 12.75091 12.75931 12.76813 12.77729 12.78673 12.79635 12.80608
## [137] 12.81585 12.82558 12.83519 12.84460 12.85373 12.86251 12.87086 12.87870
## [145] 12.88596 12.89255 12.89840 12.90520 12.91453 12.92614 12.93979 12.95523
## [153] 12.97223 12.99054 13.00991 13.03010 13.05087 13.07197 13.09316 13.11420
## [161] 13.13484 13.15484 13.17395 13.19194 13.20855 13.22354 13.23667 13.24770
## [169] 13.25638 13.26247 13.26717 13.27181 13.27639 13.28086 13.28520 13.28938
## [177] 13.29339 13.29718 13.30074 13.30403 13.30704 13.30972 13.31207 13.31404
## [185] 13.31562 13.31677 13.31747 13.31769 13.31741 13.31660 13.31523 13.31327
## [193] 13.31070 13.30749 13.30362 13.29905 13.29377 13.28774 13.28093 13.27333
## [201] 13.26490 13.25561 13.24545 13.23437 13.22080 13.20341 13.18260 13.15877
## [209] 13.13232 13.10364 13.07313 13.04120 13.00823 12.97462 12.94078 12.90709
## [217] 12.87396 12.84179 12.81096 12.78189 12.75496 12.73057 12.70913 12.69103
## [225] 12.67360 12.65408 12.63270 12.60969 12.58528 12.55970 12.53319 12.50598
## [233] 12.47830 12.45038 12.42246 12.39476 12.36752 12.34097 12.31534 12.29086
## [241] 12.26777 12.24630 12.22668 12.20914 12.19391 12.18056 12.16845 12.15747
## [249] 12.14755 12.13858 12.13049 12.12318 12.11656 12.11054 12.10504 12.09996
## [257] 12.09521 12.09070 12.08635 12.08206 12.07774 12.07330 12.06866 12.06373
## [265] 12.05840 12.05261 12.04624 12.03922 12.03319 12.02967 12.02840 12.02915
## [273] 12.03164 12.03563 12.04085 12.04707 12.05401 12.06142 12.06906 12.07665
## [281] 12.08396 12.09073 12.09669 12.10160 12.10519 12.10722 12.10744 12.10557
## [289] 12.10138 12.09589 12.09034 12.08470 12.07897 12.07316 12.06724 12.06123
## [297] 12.05511 12.04888 12.04253 12.03605 12.02945 12.02272 12.01585 12.00884
## [305] 12.00167 11.99436 11.98689 11.97925 11.97144 11.96347 11.95382 11.94123
## [313] 11.92601 11.90849 11.88898 11.86781 11.84530 11.82177 11.79754 11.77293
## [321] 11.74827 11.72386 11.70004 11.67712 11.65543 11.63528 11.61700 11.60091
## [329] 11.58733 11.57657 11.56896 11.56220 11.55388 11.54424 11.53349 11.52184
## [337] 11.50952 11.49675 11.48373 11.47069 11.45784 11.44541 11.43361 11.42266
## [345] 11.41277 11.40416 11.39705 11.39167 11.38821 11.38692 11.38799 11.39165
## [353] 11.39794 11.40667 11.41767 11.43077 11.44582 11.46266 11.48111 11.50103
## [361] 11.52224 11.54459 11.56791 11.59204 11.61682 11.64209 11.66768 11.69343
## [369] 11.71919 11.74478 11.77006 11.79484 11.81898 11.84231 11.86466 11.88589
## [377] 11.90581 11.92428 11.94370 11.96637 11.99194 12.02005 12.05038 12.08257
## [385] 12.11627 12.15114 12.18684 12.22302 12.25934 12.29544 12.33098 12.36562
## [393] 12.39902 12.43082 12.46068 12.48826 12.51320 12.53518 12.55383 12.57136
## [401] 12.59008 12.60982 12.63040 12.65165 12.67338 12.69543 12.71761 12.73975
## [409] 12.76167 12.78320 12.80417 12.82438 12.84367 12.86187 12.87879 12.89425
## [417] 12.90809 12.92013 12.93018 12.93808 12.94403 12.94842 12.95133 12.95287
## [425] 12.95312 12.95219 12.95016 12.94714 12.94320 12.93845 12.93298 12.92689
## [433] 12.92027 12.91320 12.90579 12.89814 12.89032 12.88244 12.87460 12.86688
## [441] 12.85938 12.85219 12.84540 12.83699 12.82510 12.81008 12.79229 12.77208
## [449] 12.74981 12.72583 12.70051 12.67420 12.64724 12.62001 12.59285 12.56613
## [457] 12.54018 12.51539 12.49209 12.47064 12.45140 12.43473 12.42099 12.41052
## [465] 12.40077 12.38911 12.37577 12.36098 12.34498 12.32800 12.31028 12.29205
## [473] 12.27353 12.25497 12.23660 12.21865 12.20136 12.18495 12.16967 12.15575
## [481] 12.14341 12.13290 12.12444 12.11827 12.11463 12.11261 12.11115 12.11023
## [489] 12.10984 12.10997 12.11060 12.11171 12.11329 12.11533 12.11780 12.12070
## [497] 12.12401 12.12772 12.13180 12.13625 12.14105 12.14618 12.15164 12.15739
## [505] 12.16344 12.16977 12.17787 12.18911 12.20324 12.22004 12.23927 12.26068
## [513] 12.28406 12.30915 12.33573 12.36356 12.39240 12.42201 12.45217 12.48264
## [521] 12.51317 12.54354 12.57351 12.60284 12.63129 12.65864 12.68465 12.70907
## [529] 12.73168 12.75223 12.77050 12.78625 12.79924 12.80923 12.81819 12.82815
## [537] 12.83900 12.85062 12.86289 12.87568 12.88889 12.90239 12.91606 12.92979
## [545] 12.94344 12.95692 12.97009 12.98284 12.99505 13.00659 13.01736 13.02723
## [553] 13.03608 13.04379 13.05025 13.05534 13.05893 13.06091 13.06115 13.05955
## [561] 13.05598 13.05031 13.04178 13.02990 13.01495 12.99726 12.97712 12.95485
## [569] 12.93074 12.90511 12.87826 12.85050 12.82213 12.79345 12.76478 12.73642
## [577] 12.70867 12.68184 12.65624 12.63217 12.60994 12.58986 12.57222 12.55388
## [585] 12.53172 12.50616 12.47760 12.44643 12.41306 12.37790 12.34133 12.30377
## [593] 12.26562 12.22727 12.18914 12.15161 12.11510 12.08000 12.04672 12.01565
## [601] 11.98721 11.96179 11.93979 11.92161 11.90508 11.88784 11.86997 11.85160
## [609] 11.83282 11.81375 11.79449 11.77516 11.75584 11.73667 11.71773 11.69914
## [617] 11.68100 11.66343 11.64653 11.63040 11.61515 11.60090 11.58774 11.57579
## [625] 11.56514 11.55592 11.54822 11.54215 11.53783 11.53535 11.53510 11.53728
## [633] 11.54169 11.54815 11.55646 11.56644 11.57789 11.59063 11.60446 11.61920
## [641] 11.63465 11.65064 11.66695 11.68342 11.69984 11.71602 11.73179 11.74694
## [649] 11.76128 11.77464 11.78681 11.79980 11.81555 11.83380 11.85428 11.87671
## [657] 11.90083 11.92637 11.95307 11.98065 12.00884 12.03738 12.06600 12.09442
## [665] 12.12238 12.14962 12.17586 12.20083 12.22427 12.24590 12.26546 12.28268
## [673] 12.29905 12.31616 12.33394 12.35230 12.37117 12.39045 12.41006 12.42992
## [681] 12.44995 12.47007 12.49018 12.51021 12.53007 12.54968 12.56895 12.58781
## [689] 12.60617 12.62395 12.64105 12.65741 12.67293 12.68754 12.70114 12.71403
## [697] 12.72655 12.73872 12.75055 12.76207 12.77328 12.78422 12.79488 12.80529
## [705] 12.81547 12.82542 12.83518 12.84475 12.85415 12.86340 12.87251 12.88150
## [713] 12.89039 12.89919 12.90792 12.91660 12.92512 12.93340 12.94142 12.94920
## [721] 12.95674 12.96404 12.97112 12.97798 12.98463 12.99106 12.99729 13.00332
## [729] 13.00916 13.01481 13.02027 13.02557 13.03069 13.03564 13.04044 13.04508
## [737] 13.04958 13.05389 13.05800 13.06190 13.06558 13.06907 13.07234 13.07542
## [745] 13.07829 13.08097 13.08344 13.08573 13.08781 13.08971 13.09141 13.09292
## [753] 13.09425 13.09539 13.09635 13.09712 13.09772 13.09813 13.09838 13.09845
## [761] 13.09835 13.09807 13.09762 13.09699 13.09619 13.09520 13.09404 13.09268
## [769] 13.09115 13.08943 13.08752 13.08542 13.08313 13.08064 13.07796 13.07509
## [777] 13.07201 13.06874 13.06527
#assign fits to a vector
both_trendb <- fit_bothb

#extract y min and max for each
limits_bothb <- ggplot_build(extract_bothb)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothb <- as.data.frame(limits_bothb)
both_yminb <- limits_bothb$ymin
both_ymaxb <- limits_bothb$ymax

#reassign dataframes (just to be safe)
work_bothb <- wrfb_both

#fill in missing dates to smooth fits
work_bothb <- work_bothb %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothb <- work_bothb$date

#create a new smooth dataframe to layer
smooth_frame_bothb <- data.frame(date_vec_bothb, both_trendb, both_yminb, both_ymaxb)
#WRF B
#plot smooth frames
p_wrf_b <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_bothb, y = ~both_trendb,
                    data = smooth_frame_bothb,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothb,
                                  '</br> Median Log Copies: ', round(both_trendb, digits = 2)),
                    line = list(color = '#D95F02', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothb, ymin = ~both_yminb, ymax = ~both_ymaxb,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothb, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxb, digits = 2),
                                  '</br> Min Log Copies: ', round(both_yminb, digits = 2)),
                    name = "",
                    fillcolor = '#D95F02',
                    line = list(color = '#D95F02')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF B") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfb_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#D95F02', size = 6, opacity = 0.65))

p_wrf_b
save(p_wrf_b, file = "./plotly_objs/p_wrf_b.rda")

#**************************************WRF C PLOT********************************************** #add trendlines #extract data from geom_smooth # *********************************span 0.6*********************************** #*****************Must always update the n = TOTAL NUMBER OF DAYS*************************

extract_bothc <- ggplot(wrfc_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_bothc<<-..y..), method = "loess", color = '#E7298A', 
              span = 0.25, n = 779)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothc
## `geom_smooth()` using formula 'y ~ x'

fit_bothc
##   [1] 12.05662 12.04990 12.04328 12.03675 12.03032 12.02398 12.01774 12.01158
##   [9] 12.00552 11.99954 11.99366 11.98786 11.98215 11.97653 11.97099 11.96554
##  [17] 11.96017 11.95488 11.94968 11.94455 11.93951 11.93454 11.92965 11.92484
##  [25] 11.92010 11.91545 11.91086 11.90635 11.90191 11.89754 11.89325 11.88902
##  [33] 11.88486 11.88077 11.87675 11.87280 11.86891 11.86508 11.86132 11.85762
##  [41] 11.85398 11.85040 11.84689 11.84343 11.84003 11.83668 11.83340 11.83017
##  [49] 11.82699 11.82387 11.82080 11.81779 11.81484 11.81195 11.80913 11.80638
##  [57] 11.80370 11.80109 11.79856 11.79610 11.79373 11.79144 11.78924 11.78713
##  [65] 11.78511 11.78318 11.78135 11.77962 11.77799 11.77646 11.77504 11.77373
##  [73] 11.77254 11.77145 11.77049 11.76965 11.76892 11.76833 11.76786 11.76752
##  [81] 11.76732 11.76725 11.76731 11.76752 11.76787 11.76837 11.76902 11.76982
##  [89] 11.77077 11.77188 11.77314 11.77457 11.77603 11.77741 11.77871 11.77996
##  [97] 11.78117 11.78235 11.78352 11.78468 11.78587 11.78708 11.78833 11.78964
## [105] 11.79103 11.79250 11.79407 11.79576 11.79757 11.79953 11.80164 11.80393
## [113] 11.80641 11.80908 11.81197 11.81509 11.81845 11.82206 11.82595 11.83013
## [121] 11.83461 11.83940 11.84451 11.84998 11.85580 11.86199 11.86856 11.87554
## [129] 11.88384 11.89426 11.90659 11.92063 11.93618 11.95305 11.97103 11.98992
## [137] 12.00953 12.02965 12.05009 12.07064 12.09110 12.11128 12.13098 12.14999
## [145] 12.16812 12.18517 12.20093 12.21521 12.22781 12.24108 12.25736 12.27637
## [153] 12.29786 12.32157 12.34725 12.37464 12.40347 12.43348 12.46443 12.49604
## [161] 12.52807 12.56025 12.59233 12.62404 12.65513 12.68534 12.71441 12.74208
## [169] 12.76809 12.79218 12.81411 12.83359 12.85039 12.86424 12.87488 12.88362
## [177] 12.89193 12.89981 12.90724 12.91419 12.92065 12.92662 12.93206 12.93697
## [185] 12.94133 12.94512 12.94833 12.95094 12.95293 12.95430 12.95502 12.95507
## [193] 12.95445 12.95313 12.95111 12.94835 12.94486 12.94061 12.93558 12.92976
## [201] 12.92314 12.91570 12.90741 12.89828 12.88827 12.87564 12.85889 12.83844
## [209] 12.81468 12.78801 12.75884 12.72755 12.69457 12.66027 12.62507 12.58937
## [217] 12.55356 12.51804 12.48323 12.44951 12.41729 12.38696 12.35894 12.33361
## [225] 12.31138 12.29266 12.27474 12.25480 12.23307 12.20976 12.18508 12.15926
## [233] 12.13250 12.10502 12.07705 12.04878 12.02046 11.99227 11.96446 11.93722
## [241] 11.91077 11.88534 11.86114 11.83837 11.81727 11.79805 11.78091 11.76537
## [249] 11.75072 11.73692 11.72390 11.71161 11.70000 11.68900 11.67856 11.66863
## [257] 11.65913 11.65003 11.64125 11.63275 11.62447 11.61634 11.60832 11.60034
## [265] 11.59236 11.58430 11.57612 11.56775 11.55915 11.55025 11.54100 11.53133
## [273] 11.52120 11.51157 11.50334 11.49639 11.49058 11.48579 11.48188 11.47873
## [281] 11.47619 11.47415 11.47246 11.47100 11.46963 11.46823 11.46666 11.46479
## [289] 11.46250 11.45964 11.45610 11.45172 11.44640 11.43999 11.43270 11.42487
## [297] 11.41656 11.40783 11.39876 11.38940 11.37982 11.37008 11.36024 11.35038
## [305] 11.34055 11.33081 11.32124 11.31189 11.30283 11.29412 11.28583 11.27802
## [313] 11.27076 11.26411 11.25812 11.25112 11.24154 11.22967 11.21580 11.20021
## [321] 11.18318 11.16500 11.14596 11.12633 11.10640 11.08645 11.06677 11.04765
## [329] 11.02936 11.01220 10.99643 10.98236 10.97026 10.96042 10.95311 10.94864
## [337] 10.94727 10.94812 10.95008 10.95308 10.95708 10.96201 10.96781 10.97444
## [345] 10.98182 10.98992 10.99865 11.00799 11.01785 11.02819 11.03895 11.05008
## [353] 11.06151 11.07318 11.08506 11.09706 11.10914 11.12273 11.13915 11.15814
## [361] 11.17947 11.20290 11.22819 11.25511 11.28340 11.31283 11.34317 11.37416
## [369] 11.40558 11.43718 11.46872 11.49996 11.53066 11.56058 11.58949 11.61714
## [377] 11.64329 11.66770 11.69014 11.71035 11.73055 11.75291 11.77719 11.80314
## [385] 11.83051 11.85904 11.88849 11.91862 11.94916 11.97987 12.01050 12.04080
## [393] 12.07052 12.09942 12.12723 12.15372 12.17862 12.20170 12.22270 12.24138
## [401] 12.25747 12.27238 12.28760 12.30306 12.31866 12.33434 12.35002 12.36561
## [409] 12.38103 12.39621 12.41106 12.42550 12.43946 12.45285 12.46560 12.47762
## [417] 12.48883 12.49916 12.50852 12.51684 12.52404 12.53002 12.53460 12.53767
## [425] 12.53932 12.53965 12.53875 12.53671 12.53363 12.52960 12.52470 12.51904
## [433] 12.51271 12.50579 12.49839 12.49058 12.48247 12.47415 12.46571 12.45725
## [441] 12.44885 12.44060 12.43261 12.42496 12.41775 12.41106 12.40499 12.39964
## [449] 12.39369 12.38590 12.37644 12.36550 12.35326 12.33990 12.32561 12.31057
## [457] 12.29495 12.27896 12.26275 12.24653 12.23047 12.21475 12.19955 12.18507
## [465] 12.17147 12.15895 12.14769 12.13786 12.12965 12.12138 12.11137 12.09982
## [473] 12.08695 12.07297 12.05808 12.04249 12.02641 12.01005 11.99361 11.97730
## [481] 11.96134 11.94592 11.93125 11.91756 11.90503 11.89388 11.88432 11.87655
## [489] 11.87079 11.86724 11.86509 11.86341 11.86217 11.86138 11.86103 11.86109
## [497] 11.86158 11.86247 11.86375 11.86543 11.86749 11.86992 11.87271 11.87585
## [505] 11.87935 11.88317 11.88732 11.89180 11.89658 11.90166 11.90703 11.91400
## [513] 11.92369 11.93585 11.95023 11.96658 11.98464 12.00415 12.02487 12.04654
## [521] 12.06890 12.09171 12.11470 12.13763 12.16024 12.18227 12.20348 12.22360
## [529] 12.24239 12.25959 12.27495 12.28821 12.29912 12.30743 12.31492 12.32348
## [537] 12.33301 12.34341 12.35456 12.36637 12.37872 12.39151 12.40464 12.41800
## [545] 12.43149 12.44500 12.45842 12.47165 12.48458 12.49712 12.50914 12.52056
## [553] 12.53126 12.54113 12.55008 12.55799 12.56477 12.57030 12.57448 12.57720
## [561] 12.57837 12.57787 12.57570 12.57200 12.56690 12.56052 12.55300 12.54445
## [569] 12.53500 12.52479 12.51392 12.50254 12.49076 12.47871 12.46651 12.45430
## [577] 12.44220 12.43033 12.41882 12.40780 12.39738 12.38770 12.37889 12.36881
## [585] 12.35547 12.33920 12.32034 12.29922 12.27616 12.25151 12.22558 12.19872
## [593] 12.17125 12.14350 12.11581 12.08851 12.06193 12.03640 12.01225 11.98982
## [601] 11.96943 11.95142 11.93611 11.92385 11.91288 11.90129 11.88917 11.87659
## [609] 11.86364 11.85040 11.83695 11.82338 11.80976 11.79618 11.78272 11.76947
## [617] 11.75649 11.74388 11.73172 11.72010 11.70908 11.69875 11.68920 11.68051
## [625] 11.67276 11.66603 11.66041 11.65597 11.65280 11.65098 11.65095 11.65298
## [633] 11.65690 11.66253 11.66970 11.67823 11.68796 11.69870 11.71028 11.72253
## [641] 11.73527 11.74833 11.76153 11.77470 11.78767 11.80025 11.81229 11.82359
## [649] 11.83399 11.84331 11.85138 11.85962 11.86946 11.88072 11.89327 11.90692
## [657] 11.92153 11.93692 11.95294 11.96943 11.98623 12.00317 12.02009 12.03684
## [665] 12.05325 12.06915 12.08440 12.09882 12.11226 12.12455 12.13554 12.14506
## [673] 12.15403 12.16345 12.17325 12.18340 12.19383 12.20449 12.21533 12.22629
## [681] 12.23732 12.24837 12.25939 12.27031 12.28110 12.29169 12.30203 12.31206
## [689] 12.32174 12.33102 12.33983 12.34812 12.35585 12.36295 12.36938 12.37513
## [697] 12.38030 12.38492 12.38905 12.39274 12.39603 12.39899 12.40166 12.40409
## [705] 12.40634 12.40845 12.41047 12.41246 12.41446 12.41654 12.41873 12.42109
## [713] 12.42367 12.42653 12.42970 12.43325 12.43689 12.44032 12.44356 12.44661
## [721] 12.44949 12.45221 12.45478 12.45722 12.45954 12.46175 12.46387 12.46590
## [729] 12.46786 12.46976 12.47162 12.47345 12.47525 12.47705 12.47886 12.48068
## [737] 12.48253 12.48435 12.48604 12.48763 12.48911 12.49048 12.49176 12.49294
## [745] 12.49404 12.49504 12.49597 12.49682 12.49759 12.49830 12.49895 12.49953
## [753] 12.50006 12.50054 12.50097 12.50135 12.50170 12.50202 12.50232 12.50261
## [761] 12.50289 12.50315 12.50339 12.50361 12.50380 12.50395 12.50407 12.50414
## [769] 12.50417 12.50415 12.50407 12.50394 12.50374 12.50348 12.50314 12.50273
## [777] 12.50224 12.50166 12.50100
#assign fits to a vector
both_trendc <- fit_bothc

#extract y min and max for each
limits_bothc <- ggplot_build(extract_bothc)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothc <- as.data.frame(limits_bothc)
both_yminc <- limits_bothc$ymin
both_ymaxc <- limits_bothc$ymax

#reassign dataframes (just to be safe)
work_bothc <- wrfc_both

#fill in missing dates to smooth fits
work_bothc <- work_bothc %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothc <- work_bothc$date

#create a new smooth dataframe to layer
smooth_frame_bothc <- data.frame(date_vec_bothc, both_trendc, both_yminc, both_ymaxc)
#WRF C
#plot smooth frames
p_wrf_c <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_bothc, y = ~both_trendc,
                    data = smooth_frame_bothc,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothc,
                                  '</br> Median Log Copies: ', round(both_trendc, digits = 2)),
                    line = list(color = '#E7298A', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothc, ymin = ~both_yminc, ymax = ~both_ymaxc,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothc, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxc, digits = 2),
                                  '</br> Min Log Copies: ', round(both_yminc, digits = 2)),
                    name = "",
                    fillcolor = '#E7298A',
                    line = list(color = '#E7298A')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF C") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfc_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#E7298A', size = 6, opacity = 0.65))

p_wrf_c
save(p_wrf_c, file = "./plotly_objs/p_wrf_c.rda")
save(wrfa_both, file = "./plotly_objs/wrfa_both.rda")
save(wrfb_both, file = "./plotly_objs/wrfb_both.rda")
save(wrfc_both, file = "./plotly_objs/wrfc_both.rda")
save(date_vec_botha, file = "./plotly_objs/date_vec_botha.rda")
save(date_vec_bothb, file = "./plotly_objs/date_vec_bothb.rda")
save(date_vec_bothc, file = "./plotly_objs/date_vec_bothc.rda")
save(both_ymina, file = "./plotly_objs/both_ymina.rda")
save(both_ymaxa, file = "./plotly_objs/both_ymaxa.rda")

save(both_yminb, file = "./plotly_objs/both_yminb.rda")
save(both_ymaxb, file = "./plotly_objs/both_ymaxb.rda")

save(both_yminc, file = "./plotly_objs/both_yminc.rda")
save(both_ymaxc, file = "./plotly_objs/both_ymaxc.rda")